<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>{&SITE_TITLE}</title>
	<link href="__PUBLIC__/admin/css/layout.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/js/pagination/pagination.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
	<script type="text/javascript">
		var ctrl = function(name){
			this.elements = document.getElementsByName('id[]');
			this.length = this.elements.length;
		}
		ctrl.prototype = {
			reverse:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked= !this.elements[i].checked;
				}
			},
			all:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked = true;
				}
			},
			unAll:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked = false;
				}
			},
			toggle:function(obj){
				this[obj.checked ? 'all' : 'unAll']();
			},
			del:function(id){
				if(id==undefined){
					id = [];
					for(i=0;i<this.length;i++){
						this.elements[i].checked && id.push(this.elements[i].value);
					}
					id = id.join(',');
				}
				alert('您选择了id为:'+id);
			},
			edit:function(id){
				location.href = "__URL__/edit/id/"+id;
			},
			commend:function(id,type){
				location.href = "__URL__/commend/id/"+id+"/type/"+type;
			}
		}
		var c = null;
	</script>
	</head>
	<body>
		<div id="container">
    <table class="tableborder" width="100%">
    	<form method="POST" action="__URL__/index/">
          <tbody>
            <tr class="top">
              <td class="border" colspan="2"></td>
            </tr>
            <tr>
              <th class="header" colspan="2">查询</th>
            </tr>
            <tr class="label">
              <th>说明</th>
              <th>条件</th>
            </tr>
            
            <tr class="cell">
              <td class="altbg1">
                <b>用户名:</b>
                <br/>
                <span class="smalltxt">根据用户名查询</span>
              </td>
              <td class="altbg2"><input name="name" class="txt" value="{$name}"/></td>
            </tr>
		
            <tr class="cell">
              <td class="altbg1">
                <b>用户Id</b>
                <br/>
                <span class="smalltxt">根据用户id</span>
              </td>
              <td class="altbg2"><input name="uid" class="txt" value="{$uid}"/> 多个用户用逗号隔开</td>
            </tr>
            
            <tr class="cell">
              <td class="altbg1">
                <b>email</b>
                <br/>
                <span class="smalltxt">根据用户email</span>
              </td>
              <td class="altbg2"><input name="email" class="txt" value="{$email}"/> </td>
            </tr>            
            
            <tr class="cell">
              <td class="altbg1">
                <b>用户组</b>
                <br/>
                <span class="smalltxt">用户所在组</span>
              </td>
              <td class="altbg2">
               	<select name="groupid">
              		<option value="9" >全部</option>
              		<option value="0" <eq name="groupid" value="0">selected</eq> >普通用户</option>
					<volist id="vo" name="grounlist">
					 <php>if($vo['id']==$groupid){</php>
					 	<option value="{$vo.id}" selected>{$vo.name}</option>					 
					 <php>}else{</php>
						<option value="{$vo.id}" >{$vo.name}</option>
					 <php>}</php>
					</volist>
              	</select>             
              </td>
            </tr>            

            <tr class="cell">
              <td class="altbg1">
                <b>注册时间</b>
                <br/>
                <span class="smalltxt">根据注册时间段查询。</span>
              </td>
              <td class="altbg2"><input name="bDate" class="txt" value="{$bDate}"/> - <input name="eDate" class="txt" value="{$eDate}"/></td>
            </tr>
		
            <tr class="cell">
              <td class="altbg1">
                <b>用户状态</b>
                <br/>
                <span class="smalltxt">根据用户状态查询。</span>
              </td>
              <td class="altbg2">
              	<select name="status">
              		<option value="9" >全部</option>
              		<option value="0" <eq name="status" value="0">selected</eq>>待激活</option>
              		<option value="1" <eq name="status" value="1">selected</eq>>已激活</option>
              	</select>
              </td>
            </tr>
            
            <tr class="cell">
              <td class="altbg1">
                <b>推荐状态</b>
                <br/>
                <span class="smalltxt">根据用户状态查询。</span>
              </td>
              <td class="altbg2">
 				<input type="checkbox" name="commend" value="1" <eq name="commend" value="1">checked</eq> > 已推荐
              </td>
            </tr>            

            <tr class="cell">
              <td class="altbg1">
                <b>结果排序</b>
                <br/>
              </td>
              <td class="altbg2">
                <select name="field">
                  <option value = "cTime" <eq name="field" value="cTime">selected</eq> >注册时间排序</option>
                  <option value = "id" <eq name="field" value="id">selected</eq> >注册id排序</option>
                </select>
                <select name="order">
                  <option value = "DESC" <eq name="order" value="DESC">selected</eq> >降序</option>
                  <option value = "ASC" <eq name="order" value="ASC">selected</eq> >升序</option>
                </select>
                <select name="limit">
                  <option value = "10" <eq name="limit" value="10">selected</eq> >每页显示10条</option>
                  <option value = "20" <eq name="limit" value="20">selected</eq> >每页显示20条</option>
                  <option value = "30" <eq name="limit" value="30">selected</eq> >每页显示30条</option>
                </select>
              </td>
            </tr>            
            <tr>
              <td class="footer" colspan="2">
                <input type="submit" class="submit" value="提交" />
              </td>
            </tr>
          </tbody>
          </form>
        </table>


<table class="tableborder" width="100%">
<form id="userform" action="__URL__/doBatch" method="POST">
				<tbody>
					<tr class="top">
						<td class="border" colspan="9"></td>
					</tr>
					<tr>
						<th class="header" colspan="9">标题</th>
					</tr>
					<tr>
					
						<td class="footer" colspan="9" style="text-align:left;color:blue;">
						一共有 <font color="red">{$count}</font> 用户
						</td>
					</tr>					
					<tr class="label">
						<th> 选择 <input type="checkbox" onclick="c.toggle(this)" class="checkbox"/></th>
						<th>id</th>
						<th>头像</th>
						<th>用户名</th>
						<th>email</th>
						<th>用户组</th>
						<th>注册/更新</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
<volist id="vo" name="list">					
					<tr class="cell altbg1">
						<td style="text-align:center;"><input type="checkbox" class="checkbox" name="id[]" value="{$vo.id}" /></td>
						<td>{$vo.id}</td>
						<td><a href="__TS__/space/{$vo.id}" target="_blank"><img src="{$vo.id|getUserFace='small'}" style="height:60px;"/></a></td>
						<td><a href="__TS__/space/{$vo.id}" target="_blank">{$vo.name}</a></td>
						<td>{$vo.email}</td>
						<td>{$vo.admin_level|getUserLevel}</td>
						<td>{$vo.cTime|date="Y-m-d",###}</td>
						<td><if condition="$vo.active eq '1'"><font color="blue">已激活</font><else /><font color="red">未激活</font></if></td>
						<td>
							<button type="button" onclick="c.edit({$vo.id})">编辑</button><br><button type="button" onclick="c.del(1)">删除</button>
							<if condition="$vo.commend eq '1'">
								<button type="button" onclick="c.commend({$vo.id},0)">取消推荐</button>
							<else />
								<button type="button" onclick="c.commend({$vo.id},1)" style="color:blue">推荐</button>
							</if>
						</td>
					</tr>
</volist>
					<tr class="bottom">
						<td class="border" colspan="6"> </td>
					</tr>
					<tr>
					<td colspan="5"><div style="float:left">全选<input type="checkbox" onclick="c.toggle(this)" class="checkbox"/>&nbsp;&nbsp;&nbsp;操作:<select name="dotype" style="margin-right:10px;" onchange="changeDoType(this);">
						<option value="commend">推荐</option>
						<option value="uncommend">取消推荐</option>
						<option value="active">已激活</option>
						<option value="unactive">取消激活</option>
						<option value="movegroup">转移到用户组</option>
				    </select><span name="grouplists" style="display:none;style="margin-right:10px;">用户组:<select  name="togroupId" >
				    <option value="0">普通用户组</option>
				    <volist id="vo" name="grounlist">
						<option value="{$vo.id}">{$vo.name}</option>
					</volist>
				    </select>
				    </span>
				    <input type="submit" value="提交">
						
					</div>
					
					</td>
						<td class="footer" colspan="4">
						<div class="pagination" style="float:right;">
							{$pages}
						</div>
						</td>
					</tr>
					<tr class="bottom">
						<td class="border" colspan="6">&nbsp;</td>
					</tr>
				</tbody>
				</form>
			</table>        
		</div>
		<script type="text/javascript">

			function changeDoType(o){
				var obj= $("span[name=grouplists]");
				if($(o).val()=='movegroup'){
					obj.show();
				}else{
					obj.hide();
				}
			}
			c = new ctrl('id[]');
		</script>
	</body>
</html>
